﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;
using System.Data.SqlClient;
using System.Data;

namespace DAO
{
    public partial class LoaiMonAn_DAO
    {
        public bool ThemLoaiMon(LoaiMonAn loaimon_dto)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[2];
            Parameter[0] = new SqlParameter("@TenLoaiMonAn", loaimon_dto.TenLoaiMonAn);
            Parameter[1] = new SqlParameter("@isdelete ", loaimon_dto.IsDelete);
            return dp.ExecutenonQuery("sp_ThemLoaiMonAn", Parameter);
        }
        public bool SuaLoaiMon(LoaiMonAn loaimon_dto)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[2];
            Parameter[0] = new SqlParameter("@MaLoaiMon", loaimon_dto.MaLoaiMonAn);
            Parameter[1] = new SqlParameter("@TenLoaiMon", loaimon_dto.TenLoaiMonAn);
            return dp.ExecutenonQuery("sp_SuaLoaiMonAn", Parameter);
        }

        public bool XoaLoaiMon(string MaLoaiMon)
        {
            DataProvider dp = new DataProvider();
            SqlParameter[] Parameter = new SqlParameter[1];
            Parameter[0] = new SqlParameter("@MaLoaiMonAn", MaLoaiMon);
            return dp.ExecutenonQuery("sp_XoaLoaiMonAn", Parameter);
        }

        public DataTable DanhSachLoaiMon()
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            dt = dp.ExecuteQuery("sp_DanhSachLoaiMonAn");
            return dt;
        }

        public DataTable DanhSachLoaiMon_Ma(string strMa)
        {
            DataProvider dp = new DataProvider();
            DataTable dt = new DataTable();
            SqlParameter[] Parameter = new SqlParameter[1];

            Parameter[0] = new SqlParameter("@MaLoaiMon", strMa);
            dt = dp.ExecuteQuery("sp_DanhSachLoaiMonTheoMa", Parameter);
            return dt;
        }
    }
}
